<?php

namespace addons\TfFutures\common\models;

use Yii;

/**
 * This is the model class for table "rf_addon_tf_futures_member_lever".
 *
 * @property int $id
 * @property int $member_id 用户id
 * @property int $lever_id 配资id
 * @property string $price 配资金额
 * @property string $limit 最低金额
 * @property string $sdate 开始日期
 * @property string $edate 结束日期
 * @property string $state 状态
 */
class MemberLever extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'rf_addon_tf_futures_member_lever';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['member_id', 'lever_id','price'],'required'],
            [['member_id', 'lever_id'], 'integer'],
            [['price','price_lever', 'limit'], 'number'],
            [['sdate', 'edate'], 'safe'],
            [['state'], 'string'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'member_id' => '用户id',
            'lever_id' => '配资id',
            'price' => '配资金额',
            'price_lever' => '申请金额',
            'limit' => '最低金额',
            'sdate' => '开始日期',
            'edate' => '结束日期',
            'state' => '状态',
        ];
    }

    public function getMember(){
        return $this->hasOne(\common\models\member\Member::className(),['id'=>'member_id']);
    }

    public function getLever(){
        return $this->hasOne(Lever::className(),['id'=>'lever_id']);
    }
}
